package org.deng.learn.reactor;

import reactor.core.publisher.Flux;

import java.util.Arrays;
import java.util.List;

/**
 * @author 邓力宾
 * @date 2021/2/24 11:32
 * @desc
 */
public class Main {

    public static void main(String[] args) {
        test1();
    }

    public static void test1(){

        List<String> words = Arrays.asList("th", "qu");
        Flux<String> manyLetters = Flux
                .fromIterable(words)
                .flatMap(word -> {
                    System.out.println("Step1=" + word);
                    return Flux.fromArray(word.split(""));})
                .filter(s -> {
                    System.out.println("Step2=" + s);
                    return true;
                }).filter(s -> {
                    System.out.println("Step3=" + s);
                    return true;
                });
        //manyLetters.subscribe();
        String s = manyLetters.blockLast();
        System.out.println(s);
    }
}
